package hikelin.example.aop.aspect;

import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Aspect
@Component
public class LoggingAspect {

    @Before("execution(* hikelin.example.aop.service.UserService.addUser(String)) && args(username)")
    public void beforeAddUser(String username) {
        System.out.println("Before adding user: " + username);
    }

    @AfterReturning("execution(* hikelin.example.aop.service.UserService.addUser(String)) && args(username)")
    public void afterAddUser(String username) {
        System.out.println("After adding user: " + username);
    }

}
